<template>
  <div v-cloak>
    <div>
      <span
        :class="{ redColor: isactive == 0 }"
        @click="f1(0)"
        style="margin-right: 10px; cursor: pointer"
        >首页</span
      >
      <span
        :class="{ redColor: isactive == 1 }"
        @click="f1(1)"
        style="margin-right: 10px; cursor: pointer"
        >关于我们</span
      >
      <span
        :class="{ redColor: isactive == 2 }"
        @click="f1(2)"
        style="cursor: pointer"
        >公司产品</span
      >
    </div>
    <div style="margin-top: 20px">
      <div v-if="isactive == 0">这是首页</div>
      <div v-if="isactive == 1">这是关于我们</div>
      <div v-if="isactive == 2">这是公司产品</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isactive: 0,
    };
  },
  methods: {
    f1(i) {
      console.log(i);
      this.isactive = i;
    },
  },
};
</script>

<style>
.redColor {
  color: rebeccapurple;
}
</style>
